package com.upc.service;

import com.upc.dao.DeptDao;
import com.upc.pojo.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class DeptServiceImpl implements DeptService{

    @Autowired
    private DeptDao deptDao;

    @Override
    public List<Dept> getDeptList(){
        return deptDao.getDeptList();
    }

    @Override
    public List<Dept> getDeptByPage(int curPage, int pageSize) {
        return deptDao.getDeptByPage((curPage-1)*pageSize,pageSize);
    }

    @Override
    public int delDeptById(int deptno) {
        return deptDao.delDeptById(deptno);
    }

    @Override
    public int addNewData(int deptno,String dname,String loc) {
        return deptDao.addNewData(deptno,dname,loc);
    }

    @Override
    public int updateDept(Dept dept) {
        return deptDao.updateDept(dept);
    }

    @Override
    public int getDeptCount() {
        return deptDao.getDeptCount();
    }
}
